import {useRoutes} from 'react-router-dom'
import {Layouts} from "@/layouts"
import { createRouter } from './configFun'
import ErrorPage from '../404'
import NoFind from '../noFind'
import Login from '@/pages/login'

const pageInfo = import.meta.glob('../pages/**/*.jsx')
console.log(pageInfo)
//我们要忽略的文件
const layouts = createRouter(pageInfo)
const newRoutes = [
    {
        path: '/login',
        element: <Login />
    },    
    {
        path: '',
        element: <Layouts />,
        children: layouts
    },
    {
        path: '/404',
        element: <ErrorPage />
    },
    {
        path: '*',
        element: <NoFind />
    },
]

const RouterPage = () => {
    return (
        <>
            {useRoutes(newRoutes)}
        </>
    )
}
export default RouterPage